module.exports = function(e) {
    var t = {};
    function n(r) {
        if (t[r]) return t[r].exports;
        var a = t[r] = {
            i: r,
            l: !1,
            exports: {}
        };
        return e[r].call(a.exports, a, a.exports, n), a.l = !0, a.exports;
    }
    return n.m = e, n.c = t, n.d = function(e, t, r) {
        n.o(e, t) || Object.defineProperty(e, t, {
            enumerable: !0,
            get: r
        });
    }, n.r = function(e) {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
            value: "Module"
        }), Object.defineProperty(e, "__esModule", {
            value: !0
        });
    }, n.t = function(e, t) {
        if (1 & t && (e = n(e)), 8 & t) return e;
        if (4 & t && "object" == typeof e && e && e.__esModule) return e;
        var r = Object.create(null);
        if (n.r(r), Object.defineProperty(r, "default", {
            enumerable: !0,
            value: e
        }), 2 & t && "string" != typeof e) for (var a in e) n.d(r, a, function(t) {
            return e[t];
        }.bind(null, a));
        return r;
    }, n.n = function(e) {
        var t = e && e.__esModule ? function() {
            return e.default;
        } : function() {
            return e;
        };
        return n.d(t, "a", t), t;
    }, n.o = function(e, t) {
        return Object.prototype.hasOwnProperty.call(e, t);
    }, n.p = "", n(n.s = 4);
}([ function(e, t) {
    e.exports = require("lucky-canvas");
}, function(e, t, n) {
    "use strict";
    t.__esModule = !0, t.getImage = function() {
        var e = this;
        return new Promise(function(t, n) {
            wx.canvasToTempFilePath({
                canvas: e.canvas,
                success: function(e) {
                    return t(e);
                },
                fail: function(e) {
                    return n(e);
                }
            });
        });
    };
    var r = wx.getSystemInfoSync().windowWidth, a = t.rpx2px = function(e) {
        return "string" == typeof e && (e = Number(e.replace(/[a-z]*/g, ""))), r / 750 * e;
    };
    t.changeUnits = function(e) {
        return Number(e.replace(/^(\-*[0-9.]*)([a-z%]*)$/, function(e, t, n) {
            switch (n) {
              case "px":
                t *= 1;
                break;

              case "rpx":
                t = a(t);
                break;

              default:
                t *= 1;
            }
            return t;
        }));
    }, t.resolveImage = function(e, t, n) {
        var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "src", a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "$resolve", i = n.createImage();
        i.onload = function() {
            t[a](i);
        }, i.src = t[r];
    };
}, , , function(e, t, n) {
    "use strict";
    var r = n(0), a = n(1);
    Component({
        properties: {
            width: {
                type: String,
                value: "600rpx"
            },
            height: {
                type: String,
                value: "600rpx"
            },
            blocks: {
                type: Array,
                value: []
            },
            prizes: {
                type: Array,
                value: []
            },
            slots: {
                type: Array,
                value: []
            },
            defaultConfig: {
                type: Object,
                value: {}
            },
            defaultStyle: {
                type: Object,
                value: {}
            },
            end: {
                type: null,
                value: function() {}
            }
        },
        data: {
            lucky: null,
            isShow: !1,
            luckyImg: "",
            showCanvas: !0
        },
        observers: {
            "blocks.**": function(e, t) {
                this.lucky && (this.lucky.blocks = e);
            },
            "prizes.**": function(e, t) {
                this.lucky && (this.lucky.prizes = e);
            },
            "slots.**": function(e, t) {
                this.lucky && (this.lucky.slots = e);
            }
        },
        ready: function() {
            var e = this;
            wx.createSelectorQuery().in(this).select("#slot-machine").fields({
                node: !0,
                size: !0
            }).exec(function(t) {
                if (!t[0] || !t[0].node) return console.error("lucky-canvas 获取不到 canvas 标签");
                var n = e.canvas = t[0].node, i = e.dpr = wx.getSystemInfoSync().pixelRatio, o = e.ctx = n.getContext("2d"), u = e.data;
                n.width = t[0].width * i, n.height = t[0].height * i, o.scale(i, i), e.lucky = new r.SlotMachine({
                    flag: "MP-WX",
                    ctx: o,
                    dpr: i,
                    offscreenCanvas: wx.createOffscreenCanvas({
                        type: "2d",
                        width: 300,
                        height: 150
                    }),
                    setTimeout: setTimeout,
                    clearTimeout: clearTimeout,
                    setInterval: setInterval,
                    clearInterval: clearInterval,
                    unitFunc: function(e, t) {
                        return (0, a.changeUnits)(e + t);
                    },
                    afterStart: function() {
                        e.lucky.draw(), e.setData({
                            luckyImg: "",
                            showCanvas: !0
                        });
                    }
                }, {
                    width: t[0].width,
                    height: t[0].height,
                    blocks: u.blocks,
                    prizes: u.prizes,
                    slots: u.slots,
                    defaultConfig: u.defaultConfig,
                    defaultStyle: u.defaultStyle,
                    end: function() {
                        for (var t = arguments.length, n = Array(t), r = 0; r < t; r++) n[r] = arguments[r];
                        e.triggerEvent.apply(e, [ "end" ].concat(n)), a.getImage.call(e).then(function(t) {
                            e.setData({
                                luckyImg: t.tempFilePath
                            });
                        });
                    }
                }), e.setData({
                    isShow: !0
                });
            });
        },
        methods: {
            imgBindload: function(e) {
                var t = e.currentTarget.dataset, n = t.name, r = t.index, i = t.i, o = this.data[n][r].imgs[i];
                (0, a.resolveImage)(e, o, this.canvas);
            },
            luckyImgLoad: function() {
                this.setData({
                    showCanvas: !1
                }), this.lucky.clearCanvas();
            },
            init: function() {
                var e;
                (e = this.lucky).init.apply(e, arguments);
            },
            play: function() {
                var e;
                (e = this.lucky).play.apply(e, arguments);
            },
            stop: function() {
                var e;
                (e = this.lucky).stop.apply(e, arguments);
            }
        }
    });
} ]);